<?php
	$id=$_POST['id'];
	$jabatan=$_POST['jabatan'];
	$pejabat=$_POST['pejabat'];
	$ttd=$_FILES['ttd']['name'];
	
	if(isset($_POST['submit'])){
		if($ttd != ''){
			$acak=rand(0000,9999);
			$lokasi_file=$_FILES['ttd']['tmp_name'];
			$nama_file=$_FILES['ttd']['name'];
			$nama_file_unik=$acak.$nama_file;
			move_uploaded_file($lokasi_file,"asset/images/"."$nama_file_unik");
			
			$sql="update setting set jabatan='$jabatan',nama='$pejabat',ttd='$nama_file_unik' where id_setting=$id";
		}else{
			$sql="update setting set jabatan='$jabatan',nama='$pejabat' where id_setting=$id";
		}
		$qry=mysql_query($sql);
	}
	
	$url_sukses='utama.php?module=mod_setting';
	if($qry){
		echo "<meta http-equiv='refresh' content='0; url=$url_sukses'>";
		exit;
	}else{
		echo mysql_error();
	}
?>